<?php

/**
 * IndexController - The default controller class
 * 
 * @author
 * @version 
 */

require_once 'Zend/Controller/Action.php';

class Administrator_CommentsController extends Zend_Controller_Action 
{
	

	public function init(){
		

		
	}
	
	public function preDispatch()
	{
		
		$this->getHelper ('layout')->setLayout('framelayout');
		
		$this->view->addHelperPath(MY_ROOT.'/vhelpers');
		
		Zend_Controller_Action_HelperBroker::addPath(MY_ROOT.'/chelpers');
		
		$member=new CMember();
		
		if(!$member->isUser($this->_request->getModuleName(),$this->_request->getControllerName())){
			
			$this->_redirect(MY_URL.'/administrator-auth-login');
			
			return false;
			
		}
		
		return true;
		
	}
	
   	public function replyAction(){
   		$this->_helper->viewRenderer->setNoRender();
   		$this->getHelper('layout')->disableLayout();
   		$suggestion_id = $this->_request->getParam("id");
   		$reply = $this->_request->getParam("reply");
   		$suggestionModel=new CSuggestion();
   		if($suggestionModel->updateReply($suggestion_id,$reply)){
   			echo 1;
   		}else{
   			echo 0;
   		}
   	}

   	
	public function postAction(){
	
		//$this->_helper->viewRenderer->setNoRender();
		
		//$this->getHelper ('layout')->disableLayout ();
	
	}
    

    
}
